import { Request as request } from '@/utils/request'

/**
 * 获取文件详情
 * @param attachmentId
 * @returns {*}
 */
export const getAttachment = (attachmentId:string) => {
  return request({
    url: `/file/attachment/${attachmentId}`,
    method: 'get'
  })
}
/**
 * 获取文件列表
 * @returns {*}
 */
export const getAttachments = (ids:string[]) => {
  return request({
    url: '/file/attachments',
    method: 'get',
    params: {
      ids: ids.join(',')
    }
  })
}

/**
 * 上传文件
 * @returns {*}
 */
export const uploadAttachment = (fileTypeCode:string, data: any) => {
  console.log(data.get('file'));
  return request({
    url: `/file/upload/${fileTypeCode}`,
    method: 'post',
    data
  })
}
